<%--
  Created by IntelliJ IDEA.
  User: 郝大哥
  Date: 2021/11/29
  Time: 10:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title> - 百度ECHarts</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="<%=request.getContextPath()%>/resource/favicon.ico"> <link href="<%=request.getContextPath()%>/resource/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="<%=request.getContextPath()%>/resource/css/font-awesome.css?v=4.4.0" rel="stylesheet">

    <link href="<%=request.getContextPath()%>/resource/css/animate.css" rel="stylesheet">
    <link href="<%=request.getContextPath()%>/resource/css/style.css?v=4.1.0" rel="stylesheet">

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>中国疫情比例地图</h5>
                </div>
                <div class="ibox-content">
                    <div style="height:600px" id="echarts-map-chart"></div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 全局js -->
<script src="<%=request.getContextPath()%>/resource/js/jquery.min.js?v=2.1.4"></script>
<script src="<%=request.getContextPath()%>/resource/js/bootstrap.min.js?v=3.3.6"></script>



<!-- ECharts -->
<script src="<%=request.getContextPath()%>/resource/js/plugins/echarts/echarts-all.js"></script>

<!-- 自定义js -->
<script src="<%=request.getContextPath()%>/resource/js/content.js?v=1.0.0"></script>
<script>
    $(function(){//页面加载的时候进行调用
        $.ajax({
            url:"<%=request.getContextPath()%>/yq/getChina",
            type:"get",
            dataType:"json",
            success:function(res){
                console.log(res);
                var econNum=[];//未治愈{value:,name}
                for(var i=0;i<res.length;i++){
                    econNum.push({"value":res[i].econNum,"name":res[i].name});
                }
                //1、绑定图表的div，初始化图表信息
                var myEcharts=echarts.init(document.getElementById("echarts-map-chart"));
                //2、设置图表的选项
                var option = {
                    title : {
                        text: '中国疫情未痊愈的比例图',
                        subtext: '数据来源于新浪',
                        x:'right'
                    },
                    tooltip : {
                        trigger: 'item',
                        formatter: "{a} <br/>{b} : {c} ({d}%)"
                    },
                    legend: {
                        orient : 'vertical',
                        x : 'left',
                        data:['未痊愈']
                    },
                    toolbox: {
                        show : true,
                        feature : {
                            mark : true,
                            dataView : {readOnly: false},
                            restore : true,
                            saveAsImage : true
                        }
                    },
                    calculable : true,
                    series : [
                        {
                            name:'未痊愈',
                            type:'pie',
                            radius : '55%',
                            center: ['50%', 305],
                            data:econNum
                        }
                    ]
                };

                //3、加载图片选项
                myEcharts.setOption(option);
            }
        });
    })
</script>



</body>

</html>

